package com.ytkj.ygAssist.server.util;

import com.google.gson.Gson;

public class JsonUtil {
	public static <T> T fromJson(String json, Class<T> classOfT) {
		return new Gson().fromJson(json, classOfT);
	}
	
	public static <T> T fromJsonClear(String json, Class<T> classOfT) {
		if (json.startsWith("(")) {
			json = json.substring(1, json.length()-1);
		}
		return fromJson(json,classOfT);
	}

	public static String toJson(Object object) {
		return new Gson().toJson(object);
	}
}
